#ifndef INIFILEHELPER_H
#define INIFILEHELPER_H

#ifndef INIFILEHELPER_GLOBAL_H
#define INIFILEHELPER_GLOBAL_H

#include <QtCore/qglobal.h>
#include <QObject>
#if defined(INIFILEHELPER_LIBRARY)
#  define INIFILEHELPERSHARED_EXPORT Q_DECL_EXPORT
#else
#  define INIFILEHELPERSHARED_EXPORT Q_DECL_IMPORT
#endif

#endif // INIFILEHELPER_GLOBAL_H


class INIFILEHELPERSHARED_EXPORT IniFileHelper: public QObject
{
    Q_OBJECT
public:
    IniFileHelper(QObject *parent = nullptr);
    ~IniFileHelper();

    static IniFileHelper *getInstance();


public:
    ///
    /// \brief 加载ini文件
    /// \param file_path 文件路径
    ///
    void LoadFile(QString file_path);
    ///
    /// \brief 设置值
    /// \param section  节
    /// \param key  键
    /// \param value    值
    ///
    void SetValue(QString section, QString key, QString value);
    ///
    /// \brief 设置值
    /// \param section  节
    /// \param key  键
    /// \param value    值
    ///
    void SetValue(QString section, QString key, double value);
    ///
    /// \brief 设置值
    /// \param section  节
    /// \param key  键
    /// \param value    值
    ///
    void SetValue(QString section, QString key, int value);
    ///
    /// \brief 获取节中所有的键
    /// \param section  节
    /// \return 返回所有键的名称
    ///
    QList<QString> GetKeys(QString section);
    ///
    /// \brief 获取节占所有键的值
    /// \param section  节
    /// \return 返回所有键的值
    ///
    QList<QString> GetNames(QString section);
    ///
    /// \brief 获取值
    /// \param section  节
    /// \param key  键
    /// \param value    值
    ///
    void GetValue(QString section, QString key, QString* value);

    ///
    /// \brief 获取值
    /// \param section  节
    /// \param key  键
    /// \param value    值
    ///
    void GetValue(QString section, QString key, int* value);

    ///
    /// \brief 获取值
    /// \param section  节
    /// \param key  键
    /// \param value    值
    ///
    void GetValue(QString section, QString key, double* value);
private:

};

#endif // INIFILEHELPER_H
